package com.fen.service.lmpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fen.dao.DonationprojectMapper;
import com.fen.pojo.DonationProject;
import com.fen.service.DonationprojectService;
import com.fen.vo.requset.RequestDonationOv;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
* @Description: Donationproject实现类
* @Author: lijiafen
* @Date:  2021/11/5
* @Time: 18:22
* @eamil: 2368044269@qq.com
*/
@Service
public class DonationprojectServicelmpl extends ServiceImpl<DonationprojectMapper,DonationProject> implements DonationprojectService<DonationProject> {
    @Autowired
    private DonationprojectMapper donationprojectMapper;

    @Override
    public List<DonationProject> liste() {
        /*查询全部*/
        return donationprojectMapper.list();
    }

    @Override
    public IPage<DonationProject> listdonation(RequestDonationOv requestDonationOv) {
        IPage<DonationProject> page=new Page<>(requestDonationOv.getDisplayLength(),requestDonationOv.getDisplayLength());
        QueryWrapper<DonationProject>queryWrapper=new QueryWrapper<>();
        /*分页加模糊查询*/
        if (StringUtils.checkValNotNull(requestDonationOv.getProiectName()))
        {
            queryWrapper.like("proiect_name",requestDonationOv.getProiectName());
        }
        if(StringUtils.checkValNotNull(requestDonationOv.getProiectLeader()))
        {
            queryWrapper.like("proiect_leader",requestDonationOv.getProiectLeader());
        }
        return page(page,queryWrapper);
    }
}
